package PTAyichang;

import java.util.Scanner;

public class Pta04 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Student stu = new Student();
    }
}
class IllegalScoreException extends RuntimeException{
    String message;

    public IllegalScoreException() {
    }

    public IllegalScoreException(String message) {
        this.message = message;
    }

    public IllegalScoreException(int score) {
    }

    @Override
    public String toString() {
        return "IllegalScoreException: score out of range, score="+message;
    }
}
class IllegalNameException extends RuntimeException{
    String message;

    public IllegalNameException() {
    }

    public IllegalNameException(String message) {
        this.message = message;
    }
    @Override
    public String toString() {
        return "IllegalNameException: the first char of name must not be digit, name="+message;
    }
}

class Student{
    private String name;
    private int score;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }
    public int addScore(int score) throws IllegalScoreException{
        if (score>100||score<0) {
            throw new IllegalScoreException(score);
        }
        else this.score=score;
        return this.score;
    }

    @Override
    public String toString() {
        return "Student [" + "name=" + name  + ", score=" + score + ']';
    }
}